Skip to content

Add Activity and ViewTransition components for React 19.2+#81

Merged
i-am-the-slime merged 1 commit intomainfrom
add-activity-viewtransition-components
Apr 9, 2026
Merged

Add Activity and ViewTransition components for React 19.2+#81
i-am-the-slime merged 1 commit intomainfrom
add-activity-viewtransition-components

Conversation

@i-am-the-slime
Copy link
Copy Markdown
Member

Adds two new React 19.2+ experimental components with full PureScript bindings and comprehensive test coverage.

New Modules

React.Basic.Hooks.Activity

  • Hide/show UI while preserving component state and DOM
  • ActivityMode type (Visible/Hidden)
  • Useful for tabs, sidebars, and pre-rendering content

React.Basic.Hooks.ViewTransition

  • Animated transitions using the View Transition API
  • Support for enter, exit, update, and shared element transitions
  • AnimationValue type for CSS classes or transition maps
  • Full callback support (onEnter, onExit, onUpdate, onShare)

Features

  • Complete FFI bindings to React.Activity and React.ViewTransition
  • Type-safe APIs with proper PureScript types
  • Comprehensive test suites (pending until React 19.2+ is available)
  • Full documentation with examples in README

Changes

  • Added React.Basic.Hooks.Activity module with FFI bindings
  • Added React.Basic.Hooks.ViewTransition module with FFI bindings
  • Added test specs for both components (marked as pending)
  • Updated README with usage examples and documentation
  • Added foreign-object and web-dom to dependencies

Testing

  • All existing tests pass ✅ (18/18)
  • New tests are marked as pending (10 tests) since they require React 19.2+ experimental/canary
  • Current project uses React 19.0.0 stable

Note

These components are only available in React 19.2+ experimental/canary releases, not in stable React 19.0.x. The modules are ready to use once experimental React is adopted.

@leoliu
Copy link
Copy Markdown

leoliu commented Mar 13, 2026

Activity is stable though as per https://react.dev/blog/2025/10/01/react-19-2

Activity (React 19.2 stable):
- Type-safe bindings to React.Activity
- ActivityMode type (Visible/Hidden)
- Real tests against React 19.2

ViewTransition (React canary, experimental):
- Bindings to React.unstable_ViewTransition
- AnimationValue type, ViewTransitionInstance opaque type
- viewTransitionDefaults for ergonomic record updates
- Correct callback signatures (cleanup return, instance arg)
@i-am-the-slime i-am-the-slime force-pushed the add-activity-viewtransition-components branch from af59b00 to 649c241 Compare April 9, 2026 07:40
@i-am-the-slime i-am-the-slime merged commit c99f180 into main Apr 9, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants